﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using FlanProjectData.Managers;
using FlanProjectData.Helpers;

namespace FlanProject.ScreenMenu
{
    public class OptionMenuScreen: InterfaceScreen
    {
        private static Logger logger = new Logger("OptionMenuScreen");

        #region attributs
        private float widthDistanceButton = (float)0.30;    //Define the width position in % of the button ("retour")
        private float heightDistanceButton = (float)0.85;   //Define the height position in % of the button ("retour")

        private float widthPercentButton = (float)0.43;		//Define the width in % of the button
        private float heightPercentButton = (float)0.09;	//Define the height in % of the button

        private float widthDistanceTextUp = (float)0.04;   //Define the width position in % of the title ("Option")
        private float heightDistanceTextUp = (float)0.14;   //Define the height position in % of the title ("Option")

        private float policeSize = 1;

        #endregion

        #region constructeur
        public OptionMenuScreen()
        {
            #region add Button

            this.lstMenuEntrySelectable.Add(new MenuEntry("Retour",
                new Vector2((float)windowsWidth * widthDistanceButton, (float)windowsHeight * heightDistanceButton),
                new Vector2((float)windowsWidth * widthPercentButton, (float)windowsHeight * heightPercentButton), policeSize));
			this.lstMenuEntrySelectable[0].Selected += this.ExitScreen;
            #endregion

            #region add text
            this.lstMenuEntryUnselectable.Add(new MenuEntry("Options",
                new Vector2((float)windowsWidth * widthDistanceTextUp,
                    (float)windowsHeight * heightDistanceTextUp), true, Color.Black, policeSize));

            #endregion
        }
        #endregion

        #region override HandeInput
        public override void HandleInput()
        {
            if (InputManager.IsActionTriggered(InputManager.Action.Exit))
			{
				logger.Warn("Fermeture du programme");
				this.ExitScreen();
			}
            base.HandleInput();
        }
        #endregion

        #region override LoadContent
        public override void LoadContent(ContentManager content)
        {
            this.background = content.Load<Texture2D>(@"Sprites\Menus\commonBackgroundMenu");

            // calculate the scale of the background
            base.calcScaleBackground(windowsHeight, windowsWidth);

            // Use virtual definition
            base.LoadContent(content);

        }
        #endregion
    }
}
